import request from "@/utils/request";

// 添加资金账户
export function addCapitalAccount(capitalAccountVO) {
  return request({
    url: "/system/account/add",
    method: "post",
    data: capitalAccountVO,
  });
}
// 资金账户列表
export function CapitalAccountList(capitalAccountVO) {
  return request({
    url: "/system/account/list",
    method: "post",
    data: capitalAccountVO,
  });
}
// 修改资金账户
export function CapitalAccountUpdate(capitalAccountVO) {
  return request({
    url: "/system/account/update",
    method: "post",
    data: capitalAccountVO,
  });
}
// 批量添加资金账户
export function addBatchCapitalAccount(capitalAccountList) {
  return request({
    url: "/system/account/addBatch",
    method: "post",
    data: capitalAccountList,
  });
}
// 获取编号
export function number(data) {
  return request({
    url: "/system/account/number",
    method: "get",
    params: data
  });
}


export function downloadExcel(config = {}) {
  return request({
    url: "/system/account/downloadExcelTemplate",
    method: "get",
  });
}

// 修改文件上传接口
export function uploadExcel(file, updateSupport = false) {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('updateSupport', updateSupport);  // 添加updateSupport参数
  return request({
    url: '/system/account/importExcel',  // 修改为正确的接口地址
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}
